//
//  UIViewController+ShowHUD.m
//  XiuXiuTuanGou
//
//  Created by 王克博 on 2018/7/20.
//  Copyright © 2018年 XiuXiuTuanGou. All rights reserved.
//

#import "UIViewController+ShowHUD.h"

@implementation UIViewController (ShowHUD)

//显示提醒文字 1.5秒后自动消失
- (void)showHudWithMsg:(NSString *)msg
{
    MBProgressHUD * hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
    hud.mode = MBProgressHUDModeText;
    hud.label.text = msg;
    hud.userInteractionEnabled = NO;
    hud.removeFromSuperViewOnHide = YES;
    [hud hideAnimated:YES afterDelay:1.5];
}

- (void)showHudWithMsg:(NSString *)msg afterDelay:(float)afterDelay
{
    MBProgressHUD * hud = [MBProgressHUD showHUDAddedTo:self.view.window animated:YES];
    hud.mode = MBProgressHUDModeText;
    hud.label.text = msg;
    hud.userInteractionEnabled = NO;
    hud.removeFromSuperViewOnHide = YES;
    [hud hideAnimated:YES afterDelay:afterDelay];
}

@end
